﻿<%@ Page Language="C#" MasterPageFile="~/ExampleMaster.Master" AutoEventWireup="true"
    CodeBehind="IndexedFilter.aspx.cs" Inherits="Web.Samples.IndexedFilter" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleZone" runat="server">
    Indexed Filtering
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="IntroTextZone" runat="server">
    Using the same technique as in the Indexed Select we can bring out entries that
    meet certain criteria and their order in the sequence. Notice that in this example
    we do not use a select to close our query. Select is optional is used only when
    you wish to derive another set of data from the existing set of data. For example,
    if I had wanted this to return an IEnumerable&lt;string&gt; I would use select to
    select the appropriate property. For this we simply return the set of objects who
    index in the sequence is even, we then call its name property for printing in the
    foreach loop.
    <p>
    </p>
    As with the Indexed Select there is no Query Expression example available for this
    technique
</asp:Content>
<asp:Content ContentPlaceHolderID="QueryExpressZone" runat="server" ID="myContent">
    <div class="bold">
        No Sample for Query Expression</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="QueryResultsZone" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="ImperativeZone" runat="server">
    <pre class="code">            <span style="color: rgb(0,0,255)">var</span> query = <span
        style="color: rgb(43,145,175)">Product</span>.GetProducts().Where((p, index) =&gt; index % 2 == 0);
            <span style="color: rgb(0,0,255)">foreach</span> (<span style="color: rgb(43,145,175)">Product</span> p <span
                style="color: rgb(0,0,255)">in</span> query)
                <span style="color: rgb(0,0,255)">this</span>.litImperativeResults.Text += p.Name + <span
                    style="color: rgb(163,21,21)">"&lt;br /&gt;\n"</span>;</pre>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="ImperativeResultsZone" runat="server">
    <asp:Literal ID="litImperativeResults" runat="server" />
</asp:Content>
